﻿<UserControl x:Class="WpfRcp.Views.Controls.ThreadingOptions"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Helpers="clr-namespace:WpfRcp.Helpers"
    xmlns:Controls="clr-namespace:WpfRcp.Views.Controls">

    <UserControl.Resources>
        <Controls:ThreadPoolSizeConverter x:Key="threadPoolSizeConverter" />
    </UserControl.Resources>
    
    <StackPanel>

        <Grid>
            <Label Content="{Binding Source={x:Static Helpers:ResHelper.Instance}, Path=Resource[UseThreadPool], Mode=OneWay}" HorizontalAlignment="Left" />
            <CheckBox x:Name="m_UseThreadPoolCheckBox" Width="160" IsChecked="{Binding Settings.UseThreadPool}" HorizontalAlignment="Right" />
        </Grid>

        <Grid Margin="0,5,0,0" IsEnabled="{Binding ElementName=m_UseThreadPoolCheckBox, Path=IsChecked}">
            <Label Content="{Binding Source={x:Static Helpers:ResHelper.Instance}, Path=Resource[ThreadPoolSize], Mode=OneWay}" HorizontalAlignment="Left" />
            <Slider SmallChange="1" LargeChange="2" Minimum="1" Maximum="20" Width="160" HorizontalAlignment="Right" Style="{StaticResource LinearSlider}"
                    Value="{Binding Path=Settings.ThreadPoolSize, Converter={StaticResource threadPoolSizeConverter}, Mode=TwoWay}"/>
        </Grid>

        <Grid Margin="0,15,0,0">
            <TextBlock TextWrapping="Wrap"
                       Foreground="{DynamicResource LabelForeground}"
                       Text="{Binding Source={x:Static Helpers:ResHelper.Instance}, Path=Resource[SettingsApplyNextTime], Mode=OneWay}"  HorizontalAlignment="Left" />
        </Grid>
    </StackPanel>

</UserControl>
